This invention relates to a computer system which efficiently creates snapshots holding the contents at a specific point in time of the files stored in a nonvolatile storage device.
A redundant disk structure has been used to cope with defects in a single disk. The redundancy technique, however, is useless against the loss or change of programs or data due to software bugs, erroneous operations, or infection with viruses, or against such a serious fault as the loss of a disk storage device itself. To deal with these problems, it is essential to create snapshots or backups.
A snapshot is a copy image of a file or a disk at a certain point in time. A file or the whole disk is copied at regular intervals into the same disk storage device or a different disk storage device to create a snapshot. In case a program or data has been lost or changed, the fault will be coped with by restoring the program or data or the whole disk in the snapshot created immediately before the occurrence of the fault.
A backup is a copy of the snapshot saved and stored in a different mass storage system (e.g., magnetic taps). With backups, even if the disk storage device itself has been lost (and naturally the whole data in the device has been lost), the programs or data at the time of creating the snapshots can be restored by loading the backups into a new disk storage device.
In general, to create snapshots or backups, it is necessary to stop all of the application programs that will possibly change the related files, or else they would change the files or data in the middle of creating a copy, preventing the snapshot or backup from being created correctly. Because restoring the incorrect snapshot or backup to the disk storage device introduces the danger of permitting an error or a faulty operation to occur on the application program side, the approach cannot be used to deal with the fault.
Since data is generally written into a disk storage device faster than into a mass storage system, creating snapshots and backing up them on a mass storage medium shortens the stopping time of application programs more than backing up the files or disk images directly. Use of snapshots enables the programs or data from being recovered from the loss or change in a shorter time. When backups are made using a sequential access medium, such as magnetic tape, a lot of time is needed to find a specific file, resulting in a very low efficiency.
File systems have been disclosed which have a snapshot function that solves the problem of having to stop the application programs for a long time to create snapshots or backups (reference 1: "The Episode File System," Proceedings of the Winter 1992 USENIX Conference, pp. 43-60, San Francisco, Calif.; reference 2: "File System Design for an NFS File Server Appliance," Proceedings of the Winder 1994 USENIX Conference, pp. 235-244, San Francisco, Calif.).
These file systems (e.g., in reference 2) are based on the assumption that a file has a block tree structure with root I node as the starting point as shown in FIG. 1(a). At the time of creating a snapshot, a copy of the root I node is made. The copied I node (snapshot I node) represents a block tree structure as a snapshot. The root I node to be copied represents a block tree structure of the active file system which data is read from and written into. Because the snapshot I node points at the same block as the root I node when it has just been created (FIG. 1(b)), the disk space is not used at all, except that it is used for the copied I node for a new snapshot.
Suppose the user has changed data block D. In this case, as shown in FIG. 1(c), a new data block D' is written onto a disk and the file system represented by root I node is changed to point at the new block. The original data block D on the disk remains unchanged and snapshot I node still points at the original data block D. This enables data blocks A, B, C, D, and E at the time of creating the snapshot to be referred to by specifying snapshot I node.
As described above, use of a file system with a snapshot function enables a snapshot to be created easily by simply copying the root I node without stopping the application programs. Because a snapshot can be stored in a mass storage system in parallel with the execution of the application programs, backups can be made without stopping the application programs. This eliminates the need of stopping the application programs to shelter the data in the snapshot or backup.
In the aforementioned approach, it is necessary to develop a new dedicated file system, which cannot be applied as it is to existing computer systems. Furthermore, the file system itself is based on the assumption that it has a block tree structure. Therefore, the techniques used in the file system are not applicable to an extent-based file system, such as Microsoft NTFS. A file system generally has a large tree structure. To update data block D to D', all of the intermediate nodes existing in the route between the data blocks from root I node to the data block D have to be copied as shown in FIG. 2, resulting in a great decrease in the update performance after the creation of snapshots. Moreover, the addition of a snapshot function to a file system, a complex software module, allows only the reading of snapshots and therefore makes the system much less flexible.